﻿CREATE PROCEDURE [dbo].[Forum_ClarifyNote_Put]
	@clarifyNoteId BIGINT,
	@value NVARCHAR(MAX),
	@userId UNIQUEIDENTIFIER
AS
BEGIN
	DECLARE @now DATETIME = GETUTCDATE()

	IF NOT EXISTS(SELECT * FROM [dbo].[forum_ClarifyNote] WHERE [ClarifyNoteId] = @clarifyNoteId AND [CreatedBy] = @userId AND DATEDIFF(minute, [CreatedDate], @now) < 1500000)
	BEGIN
		RETURN
	END

	UPDATE [dbo].[forum_ClarifyNote]
		 SET [Text] = @value
				,[UpdatedBy] = @userId
				,[UpdatedDate] = @now
	WHERE [ClarifyNoteId] = @clarifyNoteId

END